package ooday03_homework;

public class ReArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs= new Dog[3];
        dogs[0]=new Dog("小黑",2,"黑色");
        dogs[1]=new Dog("小黄",3,"黄色");
        dogs[2]=new Dog("小灰",4,"灰色");
        for (int i=0;i<dogs.length;i++){
            System.out.println("第"+(i+1)+"只小狗的名子是"+dogs[i].name);
            dogs[i].lookHome();
        }

        Chick[] chicks = new Chick[2];
        chicks[0]=new Chick("小黄",1,"黄色");
        chicks[1]=new Chick("小灰",2,"灰色");

        for (int i=0;i<chicks.length;i++){
            System.out.println("第"+(i+1)+"只小鸡的年龄是"+chicks[i].age);
            chicks[i].layEggs();
        }

        Fish[] fishs = new Fish[4];
        fishs[0]=new Fish("小花",1,"黄色");
        fishs[1]=new Fish("小花",2,"黄色");
        fishs[2]=new Fish("小花",3,"黄色");
        fishs[3]=new Fish("小花",4,"黄色");
        for ( int i=0;i<fishs.length;i++){
            System.out.println("第"+(i+1)+"只小鱼的颜色是"+fishs[i].color);
            fishs[i].swim();
        }

    }
}
